package com.sugon.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.StoreUserDao;
import com.sugon.entity.StoreUserEntity;
import com.sugon.service.StoreUserService;
import com.sugon.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 仓库人员关联关系Service实现类
 *
 * @author sugon
 * @date 2019-08-08 08:25:17
 */
@Service("storeUserService")
public class StoreUserServiceImpl implements StoreUserService {
    @Autowired
    private StoreUserDao storeUserDao;

    @Override
    public StoreUserEntity queryObject(String id) {
        return storeUserDao.queryObject(id);
    }

    @Override
    public List<StoreUserEntity> queryList(Map<String, Object> map) {
        return storeUserDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return storeUserDao.queryTotal(map);
    }

    @Override
    public int save(StoreUserEntity storeUser) {
        storeUser.setId(RandomUtil.randomString(32));
        storeUser.setGmtCreated(DateUtil.now());
        return storeUserDao.save(storeUser);
    }

    @Override
    public int update(StoreUserEntity storeUser) {
        storeUser.setGmtCreated(DateUtil.now());
        return storeUserDao.update(storeUser);
    }

    @Override
    public int delete(String id) {
        return storeUserDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return storeUserDao.deleteBatch(ids);
    }
}
